# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-latex2mathml
pkgver=3.76.0
pkgrel=1
pkgdesc="Pure Python library for LaTeX to MathML conversion"
url="https://github.com/roniemartinez/latex2mathml"
license=('MIT')
arch=('any')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-poetry-core')
checkdepends=('python-pytest' 'python-multidict' 'python-xmljson')
source=("https://github.com/roniemartinez/latex2mathml/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('e3e6bfb1e97110a80752f45af35f8574a7e10d77e3c4e61a3b5ebee12470419f4c40bed46fde6e0565fe81ab4fd8ad34597853ede81598cec273d2e13434c21d')

prepare() {
  cd latex2mathml-$pkgver
  sed -i '/--cov/d' pyproject.toml
}

build() {
  cd latex2mathml-$pkgver
  python -m build -nw
}

check() {
  cd latex2mathml-$pkgver
  python -m installer -d tmp_install dist/*.whl
  PYTHONPATH="$PWD/tmp_install/usr/lib/python3.11/site-packages" pytest
}

package() {
  cd latex2mathml-$pkgver
  python -m installer -d "$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
